﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace Ch15MidBasic
{
    public partial class frmContainer : Form
    {
        private int mCounter;
        //private string filename;
        public frmContainer()
        {
            InitializeComponent();
            mCounter = 1;
            frmChild child = new frmChild(this, mCounter);
            child.Show();
        }

        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmChild newFrom = new frmChild(this,++mCounter);
            newFrom.Show();
        }

        private void tileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileHorizontal);
        }

        private void cascadeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.Cascade);
        }

        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.dlgOpenFile.ShowDialog() == DialogResult.OK)
            {
                frmChild newFrom = new frmChild(this,-1); 
                newFrom.Text = dlgOpenFile.FileName;              
                newFrom.Show();                
                newFrom.OpenFile(dlgOpenFile.FileName);
                
                
            }
            
        }

    }
}
